package fr.grassaud.hmvc.sample;

import fr.grassaud.hmvc.component.ControlledModel;
import fr.grassaud.hmvc.component.ControlledView;
import fr.grassaud.hmvc.component.Controller;
import fr.grassaud.hmvc.event.HMVCEvent;
import fr.grassaud.hmvc.event.OnRelease;
import fr.grassaud.hmvc.event.OnViewEvent;
import fr.grassaud.hmvc.session.HMVCSession;
import fr.grassaud.hmvc.session.SessionContext;

@Controller
public class ChildController {

    
    @ControlledModel
    private ChildModel model;
    
    @ControlledView
    private ChildView view;
    
    @SessionContext
    private HMVCSession session;
    
    
    
    public void displayDetail() {
	session.sendControllerEvent(this, new HMVCEvent("displayDetail", this));
    }
    
    public void changeData(ChildEvent event) {
	model.dynamicChangeModel(event.getData());
	
    }
    
    @OnRelease
    @OnViewEvent(name=ChildReleaseEvent.NAME)
    protected void release(ChildReleaseEvent event) {
	//do nothing 
    }
    
}
